<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="">
<meta name="author" content="ThemeBucket">
<link rel="shortcut icon" href="#" type="../image/png">
<title>欢迎模版页</title>
<!--data table-->
<link rel="stylesheet" href="../js/data-tables/DT_bootstrap.css" />
</head>
<body class="sticky-header"
	onload="indexmenu('${oneMenu}','${twoMenu}');">
	<%@ include file="../index/index.jsp"%>
	<section>
		<div class="main-content">
			<!-- 	地址栏 -->
			<div class="page-heading">
				<h3>后台管理系统</h3>
				<ul class="breadcrumb">
					<li><a href="#">订单管理</a></li>
					<li class="active">顾客订单</li>
				</ul>
			</div>
			<!--内容开始的地方-->
			<section class="panel">
				<header class="panel-heading custom-tab turquoise-tab">
					<ul class="nav nav-tabs">
						<li class=""><a href="#noPayOrders" data-toggle="tab"
							onclick="clickOrders(1,4,0)">未付款</a></li>
						<li class="active">
							<!-- clickOrders(1,1,0) --> <a href="" data-toggle="tab"
							onclick="clickOrders(1,3,0)">已付款(制作订单)</a>
						</li>
						<li class=""><a href="#systemSuccessJieOrders"
							data-toggle="tab" onclick="clickOrders(1,8,0)">系统已处理</a></li>
						<!--  
                                <li class="">
                                    <a href="#zhiZuoZhongOrders" data-toggle="tab"   onclick="clickOrders(1,3,0)">配货中</a>
                                </li>
                                <li class="">
                                    <a href="#zhiZuoWanOrders" data-toggle="tab"   onclick="clickOrders(1,4,0)">配货完成</a>
                                </li>
                                  <li class="">
                                    <a href="#tuiKuanWeiChuLiOrders" data-toggle="tab"  onclick="clickOrders(1,7,0)">退款未处理</a>
                                </li>
                                -->
						<li class=""><a href="#yiFaHuoOrders" data-toggle="tab"
							onclick="clickOrders(1,14,0)">已发货</a></li>
						<li class=""><a href="#yiShouHuoOrders" data-toggle="tab"
							onclick="clickOrders(1,15,0)">已收货</a></li>
						<li class=""><a href="#yiTuiKuanOrders" data-toggle="tab"
							onclick="clickOrders(1,7,0)">已退款</a></li>
					</ul>
				</header>
				<div class="panel-body">
					<div class="tab-content">
						<div id="noPayOrders" class="tab-pane active">
							<!-- 顾客订单 -->
							<table
								class="display table table-bordered table-striped dataTable table-hover"
								id="dynamic-table" aria-describedby="dynamic-table_info">
								<thead>
									<tr role="row">
										<th role="columnheader" tabindex="0"
											aria-controls="dynamic-table" rowspan="1" colspan="1"
											
											aria-label="Rendering engine: activate to sort column ascending">订单号</th>
										<th role="columnheader" tabindex="0"
											aria-controls="dynamic-table" rowspan="1" colspan="1"
											
											aria-label="Rendering engine: activate to sort column ascending">下单人</th>
										<th role="columnheader" tabindex="0"
											aria-controls="dynamic-table" rowspan="1" colspan="1"
											aria-label="Rendering engine: activate to sort column ascending">下单人电话</th>
										<th role="columnheader" tabindex="0"
											aria-controls="dynamic-table" rowspan="1" colspan="1"
											aria-label="Rendering engine: activate to sort column ascending">推荐商家</th>
										<th role="columnheader" tabindex="0"
											aria-controls="dynamic-table" rowspan="1" colspan="1"
											
											aria-label="Rendering engine: activate to sort column ascending">收货人</th>
										<th tabindex="0" aria-controls="dynamic-table" rowspan="1"
											colspan="1"  aria-sort="descending"
											aria-label="Browser: activate to sort column ascending">下单时间</th>
										<th role="columnheader" tabindex="0"
											aria-controls="dynamic-table" rowspan="1" colspan="1"
											
											aria-label="Engine version: activate to sort column ascending">备注</th>
										<th role="columnheader" tabindex="0"
											aria-controls="dynamic-table" rowspan="1" colspan="1"
											
											aria-label="Platform(s): activate to sort column ascending">订单状态</th>
										<th role="columnheader" tabindex="0"
											aria-controls="dynamic-table" rowspan="1" colspan="1"
											
											aria-label="Platform(s): activate to sort column ascending">订单价格</th>
										<th >操作</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${orders}" var="order">
										<tr class="gradeA even" data-toggle="modal">
											<td>${order.indentId}</td>
											<td>${order.name}</td>
											<td>${order.phone}</td>
											<td>${order.businessName}( <c:choose>
													<c:when test="${order.vertification=='1' }">代理商</c:when>
													<c:when test="${order.vertification=='2' }">经销商</c:when>
													<c:when test="${order.vertification=='3' }">推广大使</c:when>
													<c:otherwise>其他</c:otherwise>
												</c:choose> )
											</td>
											<td>${order.takeGoodsTel}</td>
											<td>${order.beginTime}</td>
											<td>${order.remark}</td>
											<td>已付款</td>
											<td>${order.indentGoodsPrice}</td>
											
											<td>
												<!--  <button class="btn btn-info" type="button">去审核</button>&nbsp;&nbsp;-->
												<button class="btn btn-info" type="button"
													data-toggle="modal" data-target="#myModal"
													onclick="findGoodsByOrderId2(${order.indentId})">查看订单详情</button>
											</td>
										</tr>
									</c:forEach>

								</tbody>
							</table>
							<!-- 分页开始 -->
							<div class="row-fluid">
								<div class="span6">
									<div class="dataTables_paginate paging_bootstrap pagination">
										<ul>
											<c:choose>
												<c:when test="${page.currentPage==1}">
													<li class="prev"><a class="page-link">← 上一页</a></li>
												</c:when>
												<c:otherwise>
													<li class="prev"><a
														href="../orders/toNewOrders.do?currentPage=${page.currentPage-1}&status=3&afterSale=0"
														class="page-link">← 上一页</a></li>
												</c:otherwise>
											</c:choose>
											<c:forEach begin="1" end="${page.totalPage}" var="p">
												<c:choose>
													<c:when test="${page.currentPage==p}">
														<c:if test="${p==1}">
															<li class="active page-item"><a class="page-link"
																href="../orders/toNewOrders.do?currentPage=${p}&status=3&afterSale=0"
																class="page-link">${p}</a></li>
															<c:if test="${page.totalPage>1}">
																<li class="page-item"><a class="page-link"
																	href="../orders/toNewOrders.do?currentPage=${p+1}&status=3&afterSale=0">${p+1}</a></li>
															</c:if>
															<c:if test="${page.totalPage>2}">
																<li class="page-item"><a class="page-link"
																	href="../orders/toNewOrders.do?currentPage=${p+2}&status=3&afterSale=0">${p+2}</a></li>
															</c:if>
															<c:if test="${page.totalPage>3}">
																<li class="page-item"><a class="page-link" href="#">...</a></li>
															</c:if>
														</c:if>
														<c:if test="${p>1}">
															<c:if test="${p<page.totalPage}">
																<c:if test="${p>2}">
																	<li class="page-item"><a class="page-link"
																		href="#">...</a></li>
																</c:if>
																<li class="page-item"><a class="page-link"
																	href="../orders/toNewOrders.do?currentPage=${p-1}&status=3&afterSale=0">${p-1}</a></li>
																<li class="active page-item"><a class="page-link"
																	href="../orders/toNewOrders.do?currentPage=${p}&status=3&afterSale=0"
																	class="current_page">${p}</a></li>
																<c:if test="${page.totalPage>2}">
																	<li class="page-item"><a class="page-link"
																		href="../orders/toNewOrders.do?currentPage=${p+1}&status=3&afterSale=0">${p+1}</a></li>
																</c:if>
																<c:if test="${page.totalPage-p>1}">
																	<li class="page-item"><a class="page-link"
																		href="#">...</a></li>
																</c:if>
															</c:if>
															<c:if test="${p==page.totalPage}">
																<c:if test="${p>3}">
																	<li class="page-item"><a class="page-link"
																		href="#">...</a></li>
																</c:if>
																<c:if test="${p>2}">
																	<li class="page-item"><a class="page-link"
																		href="../orders/toNewOrders.do?currentPage=${p-2}&status=3&afterSale=0">${p-2}</a></li>
																</c:if>
																<li class="page-item"><a class="page-link"
																	href="../orders/toNewOrders.do?currentPage=${p-1}&status=3&afterSale=0">${p-1}</a></li>
																<li class="active page-item"><a class="page-link"
																	href="../orders/toNewOrders.do?currentPage=${p}&status=3&afterSale=0"
																	class="current_page">${p}</a></li>
															</c:if>
														</c:if>
													</c:when>
												</c:choose>
											</c:forEach>

											<c:choose>
												<c:when test="${page.currentPage==page.totalPage}">
													<li class="pre"><a class="page-link">下一页 → </a></li>
												</c:when>
												<c:otherwise>
													<li class="pre"><a
														href="../orders/toNewOrders.do?currentPage=${page.currentPage+1}&status=3&afterSale=0"
														class="page-link">← 下一页</a></li>
												</c:otherwise>
											</c:choose>
											<li class="page-item"><a class="page-link">总共${page.totalPage}页</a></li>
										</ul>
									</div>
								</div>
							</div>
							<!-- 分页结束 -->
						</div>
					</div>
				</div>
			</section>
			<div class="modal fade bs-example-modal-lg" id="myModal"
				tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
				aria-hidden="true">
				<div class="modal-dialog modal-lg">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal">
								<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
							</button>
							<h4 class="modal-title" id="myModalLabel">订单详情</h4>
						</div>
						<div class="modal-body" id="orderDetailDiv">
							<!--这是模态框内容  -->
							<table
								class="display table table-bordered table-striped dataTable table-hover"
								id="tb_goodsDetail" aria-describedby="dynamic-table_info">
							</table>
							<!-- 这是模态框内容结束 -->
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default"
								data-dismiss="modal">关闭</button>
						</div>
					</div>
				</div>
			</div>
			<!--内容结束了 -->
		</div>
	</section>
</body>
<script src="../js/orders/customerOrders.js"></script>
<link href="${ctxPath}/js/bootstrap-table/bootstrap-table.css"
	rel="stylesheet" />
<!-- tables插件的引用 -->
<script src="${ctxPath}/js/bootstrap-table/bootstrap-table.js"></script>
<script
	src="${ctxPath}/js/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
<script type="text/javascript">
var TableInit = function() {
	var oTableInit = new Object();
	//初始化Table
	oTableInit.Init = function(indentId) {
		$("#tb_goodsDetail").bootstrapTable('destroy'); 
		$('#tb_goodsDetail')
				.bootstrapTable(
						{
							url :'${ctxPath}/orders/showGoods.do?indentId='+indentId, //请求后台的URL（*）
							method : 'get', //请求方式（*）
							striped : true, //是否显示行间隔色
							undefinedText:"",
							cache : false, //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
							pagination : false, //是否显示分页（*）
							sortable : false, //是否启用排序
							sortName : 'sampleId',
							sortOrder : "desc", //排序方式
							//queryParams : oTableInit.queryParams,//传递参数（*）
							sidePagination : "server", //分页方式：client客户端分页，server服务端分页（*）
							pageNumber : 1, //初始化加载第一页，默认第一页
							pageSize : 8, //每页的记录行数（*）
							pageList : [ 8, 25, 50, 100 ],
							search : false, //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
							strictSearch : false,
							showColumns : false, //是否显示所有的列
							minimumCountColumns : 2, //最少允许的列数
							clickToSelect : false, //是否启用点击选中行
							height : 600, //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
							uniqueId : "sampleId", //每一行的唯一标识，一般为主键列
							cardView : false, //是否显示详细视图
							detailView : false, //是否显示父子表
							contentType : 'application/x-www-form-urlencoded; charset=UTF-8',
							columns : [
									{
										field : 'sampleId',
										title : 'ID',
										width : '3%',
										align : "center"
									},
									{
										field : 'sampleDescribe',
										title : '商品描述',
										width : '11%',
										align : "center"
									},
									{
										field : 'goodsPrice',
										title : '金额',
										width : '11%',
										align : "center"
									},
									{
										field : 'brand',
										title : '品牌',
										width : '10%',
										align : "center"
									},
									{
										field : 'series',
										title : '系列号',
										width : '20%',
										align : "center"
									},
									{
										field : 'customerAddress',
										title : '分类',
										width : '8%',
										align : "center",
										formatter : function(value, row,
												index) {
											if(value==0){
												return '布艺帘';											
											}else{
												return '成品帘';
											}
										}
									},
									{
										field : 'structure',
										title : '结构',
										width : '10%',
										align : "center",
										formatter : function(value, row,
												index) {
											if(value==0){
												return '单布';
											}else if(value==1){
												return '单纱';
											}else if(value==2){
												return '布+纱';
											}
										}
									},
									{
										field : 'style',
										title : '款式',
										width : '10%',
										align : "center",
										formatter : function(value, row,
												index) {
											if (value == 0) {
												return "打孔";
											} else if(value == 1){
												return "韩折";
											}else if(value == 2){
												return "挂钩";
											}else if(value == 3){
												return "韩折或挂钩";
											}else if(value == 4){
												return "帘头款";
											}
										}
									},
									{
										field : 'times_fold',
										title : '倍折',
										width : '10%',
										align : "center",										
									},
									{
										field : 'shadeDesign',
										title : '帘头款式',
										width : '10%',
										align : "center",										
									},]
						});
	};

	//得到查询的参数
	oTableInit.queryParams = function(params) {
		var temp = { //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
			//limit : params.limit, //页面大小
			//offset : params.offset, //页码
			//order : params.order,
			//sort : params.sort,
			//indentId : 638,
		 };
		return temp;
	  };
	  return oTableInit;
    };
function findGoodsByOrderId2(indentId){	
	$("#myModal").modal('show');
	 var oTable = new TableInit();
	 oTable.Init(indentId);
}
</script>
</html>
